//
//  InviteViewController.m
//  LiquorChain
//
//  Created by apple on 2018/12/26.
//  Copyright © 2018年 王冬. All rights reserved.
//

#import "InviteViewController.h"

@interface InviteViewController ()
@property (nonatomic,strong)UILabel *codeLabel;
@end

@implementation InviteViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"邀请好友";
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self creatView];
    // Do any additional setup after loading the view.
}



-(void)creatView{
    UIView *headView =[[UIView alloc]init];
    [self.view addSubview:headView];
    headView.backgroundColor =[UIColor blueColor];
    [headView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(kNavBarHeight);
        make.left.right.mas_equalTo(0);
        make.height.mas_equalTo(194);
    }];
    UILabel *titleLabel =[[UILabel alloc]init];
    [headView addSubview:titleLabel];
    titleLabel.text = @"酿酒基地";
    titleLabel.textColor=[UIColor whiteColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.font =[UIFont systemFontOfSize:40];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(42);
        make.left.mas_equalTo(100);
        make.right.mas_equalTo(-100);
        make.height.mas_equalTo(37);
    }];
    UILabel *contentLabel =[[UILabel alloc]init];
    [headView addSubview:contentLabel];
    contentLabel.text =@"共创价值,共享财富,共生未来";
    contentLabel.textColor =[UIColor whiteColor];
    contentLabel.font =[UIFont systemFontOfSize:14];
    contentLabel.textAlignment = NSTextAlignmentCenter;
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(titleLabel.mas_bottom).with.offset(10);
        make.left.mas_equalTo(titleLabel.mas_left).with.offset(-10);
        make.right.mas_equalTo(titleLabel.mas_right).with.offset(10);
        make.height.mas_equalTo(13);
    }];
    
    UIView *bodyView =[[UIView alloc]init];
    [headView addSubview:bodyView];
    bodyView.backgroundColor =[UIColor whiteColor];
    bodyView.layer.cornerRadius = 10;
    [bodyView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(134);
        make.left.mas_equalTo(17);
        make.right.mas_equalTo(-17);
        make.height.mas_equalTo(220);
        
    }];
    UILabel *topLabel =[[UILabel alloc]init];
    [bodyView addSubview:topLabel];
    topLabel.text = @"您的邀请码";
    topLabel.textColor = RGBA(201.0, 18.0, 85.0, 1);
    topLabel.font =[UIFont systemFontOfSize:14];
    topLabel.textAlignment = NSTextAlignmentCenter;
    [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(21);
        make.left.mas_equalTo(137);
        make.right.mas_equalTo(-137);
        make.height.mas_equalTo(13);
    }];
    UILabel *codeLabel =[[UILabel alloc]init];
    self.codeLabel = codeLabel;
    [bodyView addSubview:codeLabel];
    codeLabel.text = @"U0E99";
    codeLabel.textColor = CUSTOMCOLOR;
    codeLabel.textAlignment = NSTextAlignmentCenter;
    codeLabel.font =[UIFont systemFontOfSize:36];
    [codeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(topLabel.mas_bottom).with.offset(10);
        make.left.mas_equalTo(topLabel.mas_left).with.offset(-20);
        make.right.mas_equalTo(topLabel.mas_right).with.offset(20);
        make.height.mas_equalTo(27);
    }];
    UILabel *paiLabel =[[UILabel alloc]init];
    [bodyView addSubview:paiLabel];
    paiLabel.font =[UIFont systemFontOfSize:12];
    paiLabel.textAlignment =NSTextAlignmentCenter;
    paiLabel.textColor = RGBA(136.0, 136.0, 136.0, 1);
    paiLabel.text = @"酒链世界第200000位酿酒师";
    [paiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(codeLabel.mas_bottom).with.offset(8);
        make.left.mas_equalTo(codeLabel.mas_left).with.offset(-25);
        make.right.mas_equalTo(codeLabel.mas_right).with.offset(25);
        make.height.mas_equalTo(12);
    }];
    UIButton *copyBtn =[UIButton buttonWithType:UIButtonTypeCustom];
    [bodyView addSubview:copyBtn];
    copyBtn.backgroundColor = CUSTOMCOLOR;
    copyBtn.layer.cornerRadius = 18;
    [copyBtn setTitle:@"复制邀请码" forState:UIControlStateNormal];
    [copyBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    copyBtn.titleLabel.font =[UIFont systemFontOfSize:12];
    [copyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(paiLabel.mas_bottom).with.offset(19);
        make.left.mas_equalTo(paiLabel.mas_left).with.offset(29);
        make.right.mas_equalTo(paiLabel.mas_right).with.offset(-29);
        make.height.mas_equalTo(35);
    }];
    [copyBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    
    UILabel *infoLabel =[[UILabel alloc]init];
    [bodyView addSubview:infoLabel];
    infoLabel.text = @"邀请9名合格粉丝，即为酒链大师，每邀请1名好友+10酿力";
    infoLabel.numberOfLines = 0;
    infoLabel.font=[UIFont systemFontOfSize:14];
    [infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(copyBtn.mas_bottom).with.offset(20);
        make.left.mas_equalTo(17);
        make.right.mas_equalTo(-17);
        make.height.mas_equalTo(34);
    }];
    UIImageView *bottomImageView=[[UIImageView alloc]init];
    [self.view addSubview:bottomImageView];
    //bottomImageView.backgroundColor=[UIColor redColor];
    bottomImageView.image =[UIImage imageNamed:@"qcode"];
    [bottomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bodyView.mas_bottom).with.offset(40);
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.width.mas_equalTo(130);
        make.height.mas_equalTo(130);
        
    }];
    UILabel *showLabel =[[UILabel alloc]init];
    [self.view addSubview:showLabel];
    showLabel.text= @"扫码下载酒链APP";
    showLabel.textAlignment = NSTextAlignmentCenter;
    showLabel.font =[UIFont systemFontOfSize:12];
    showLabel.textColor = RGBA(228.0, 42.0, 110.0, 1);
    
    [showLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(bottomImageView.mas_bottom).with.offset(11);
        make.left.mas_equalTo(bottomImageView.mas_left).with.offset(15);
        make.right.mas_equalTo(bottomImageView.mas_right).with.offset(-15);
        make.height.mas_equalTo(12);
    }];

    
    
}
-(void)click:(UIButton *)sender{
    NSLog(@"111");
    
//    UIPasteboard *copy = [UIPasteboard generalPasteboard];
//    [copy setString:self.codeLabel.text];
//    if (copy == nil || [self.codeLabel.text isEqualToString:@""]==YES)
//    {
//        [MBProgressHUD showError:@"复制失败" toView:self.view];
//    }else{
//        [MBProgressHUD showSuccess:@"复制成功" toView:self.view];
//    }
 
}


@end
